package can.bishe.modules.exam.service.impl;



import can.bishe.modules.exam.entity.ExamOptionEntity;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import can.bishe.common.utils.PageUtils;
import can.bishe.common.utils.Query;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import can.bishe.modules.exam.dao.ExamSubjectDao;
import can.bishe.modules.exam.entity.ExamSubjectEntity;
import can.bishe.modules.exam.service.ExamSubjectService;


@Service("examSubjectService")
public class ExamSubjectServiceImpl extends ServiceImpl<ExamSubjectDao, ExamSubjectEntity> implements ExamSubjectService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        IPage<ExamSubjectEntity> page = this.page(
                new Query<ExamSubjectEntity>().getPage(params),
                new QueryWrapper<ExamSubjectEntity>()
        );
        for(ExamSubjectEntity examSubjectOne:page.getRecords()){
            List<Map<String,Object>> optionList = this.baseMapper.getSubjectOverView(examSubjectOne.getSubjectId().intValue());
            examSubjectOne.setOptionList(optionList);
        }
        return new PageUtils(page);
    }

}
